home *** CD-ROM | disk | FTP | other *** search
- #include "extdrv.h"
- #include "file.h"
- #include "ctype.h"
- #include "dir.h"
- #include "buffer.h"
- #include "dos.h"
- #include "extern.h"
-
- extern char data_buf[];
-
- void get_path(char *path)
- {
- char *s;
-
- s = strrchr(path, '\\');
- if (s[1] == '.' && s[2] == '\0'){
- if (s != path)
- s[0] = '\0';
- else
- s[1] = '\0';
- return;
- }
- if (s[1] == '.' && s[2] == '.' && s[3] == '\0'){
- if (s != path){
- s[0] = '\0';
- s = strrchr(path, '\\');
- }
- if (s != path)
- s[0] = '\0';
- else
- s[1] = '\0';
- }
- }
-
- void splitPath(char *path, char *name)
- {
- char *s;
-
- s = strrchr(path, '\\');
- strcpy(name, s + 1);
- if (s == path)
- s[1] = '\0';
- else
- s[0] = '\0';
- }
-
- u_char *strrchr(u_char *s, u_char ch)
- {
- u_char *p;
-
- p = (u_char *)NULL;
- while (*s != '\0'){
- if (issjis1(s[0]) && issjis2(s[1]))
- s++;
- else if (*s == ch)
- p = s;
- s++;
- }
- return (p);
- }
-
- hasWild(char *s)
- {
- for (; *s != '\0'; s++){
- if (*s == '?' || *s == '*')
- return (TRUE);
- }
- return (FALSE);
- }
-
- void expand(char *s, char *t)
- {
- int n;
-
- strcpy(t, " ");
- if (s[0] == '.'){
- t[0] = '.';
- if (s[1] == '.')
- t[1] = '.';
- return;
- }
- n = 8;
- while (*s != '\0'){
- if (*s == '*'){
- s++;
- while (--n >= 0)
- *t++ = '?';
- break;
- }
- if (*s == '.'){
- t += n;
- break;
- }
- *t++ = *s++;
- n--;
- }
- if (*s != '.')
- return;
- s++;
- n = 3;
- while (*s != '\0'){
- if (*s == '*'){
- while (--n >= 0)
- *t++ = '?';
- break;
- }
- *t++ = *s++;
- n--;
- }
- }
-
- match(char far *fname, char *pattern)
- {
- int n;
-
- for (n = 0; n < 11; n++, fname++, pattern++){
- if (*fname == *pattern)
- continue;
- if (*pattern == '?')
- continue;
- return (FALSE);
- }
- return (TRUE);
- }
-
- u_long laddr(u_short off, u_short seg)
- {
- return (((u_long)seg << 4) + (u_long)off);
- }
-